home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Video Toaster 4.3
/
Video Toaster v4.3.iso
/
3.1
/
toasterall
/
arexx_examples
/
tpaint
/
tpcomposite.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1992-01-29
|
3KB
|
105 lines
/* TPComposite.rexx -- Composite images in ToasterPaint */
/* By Arnie Cachelin © 1992 NewTek Inc. */
/*
This program will merge two images in ToasterPaint, with variable transparency
applied to the second image. The optional blend percentage (0-100%) is
the weight of the blend of the second picture; 0% leaves picture 1
unchanged, 100% mixes the two images with equal weight. This is the
default weight.
To use the program, make sure TPaint is running, rexx is installed and
this script is in the current directory or in 'REXX:'. From a shell,
simply type "rx TPComposite pic1 pic2 Blend savename". If no blend is
specified, 100% is used. If a blend % and a save name are included,
the final image wll be saved using that name.
*/
PARSE ARG file1 file2 mix outfile
if file1="" | file2="" then do
say "Usage: rx TPComposite Pic1 Pic2 [Blend %] [save name]"
exit
end
Address "DigiPaint" /* Tell ARexx where commands go */
if pos("DigiPaint",show(ports))=0 then do
say "Can't find ToasterPaint!"
exit
end
if ~exists(file1) then do
say "Can't find first input image file "file1
exit
end
if ~exists(file2) then do
say "Can't find second input image file "file2
exit
end
Call LoadRGB(file1)
'Swap' /* Load pic 2 into swap screen */
Call LoadRGB(file2)
if mix="" then mix=100
if mix>100 then mix=100
if mix<0 then mix=1
mix=((mix/100)*x2d(8000))%1 /* Make mix up to 50% blend 0x8000 */
blend="$"||d2x(mix,4) /* Set up hex value for blend slider */
'Swap' /* Back to pic 1 screen */
'Flon' /* Fill On */
'Hvof' /* Set gradient blend off */
'Pot0' blend /* Set transparency level */
'Mswa' /* Merge swap screen in */
if outfile~="" then SaveRGB(outfile)
exit
LoadFrameStore: PROCEDURE /* Load FrameStore */
arg filename /* must have ###.fs on front! */
'Loco' /* Call file requester */
'Fnam'filename /* Enter File name */
'Okls' /* Hit the OK button */
return 0
SaveFrameStore: PROCEDURE /* Save FrameStore */
arg filename /* must have ###.fs on front! */
'Saco' /* Call file requester */
'Fnam'filename /* Enter File name */
'Okls' /* Hit the OK button */
return 0
LoadRGB: PROCEDURE /* Load IFF RGB, copy into swap buffer */
arg filename
'Lo24' /* Call file requester */
Call SetFile(filename)
return
SaveRGB: PROCEDURE /* Save IFF RGB, copy into swap buffer */
arg filename
'Sa24' /* Call file requester */
Call SetFile(filename)
return
SetFile: PROCEDURE /* Select file in current requester */
arg file
dirname=GetPathName(file)
'Dnam'dirname /* Enter file path */
'Dsel' /* Hit return on directory */
filename=GetFileName(file)
'Fnam'filename /* Enter File name */
'Okls' /* Hit the OK button */
return
GetFileName: procedure /* Extract file name from full file specification */
ARG fullfile
c = lastpos("/",fullfile)
if c = 0 then c = lastpos(":",fullfile)
return substr(fullfile, c + 1)
GetPathName: procedure /* Extract directory name from full file specification */
ARG fullfile
c = lastpos("/",fullfile)
if c = 0 then c = lastpos(":",fullfile)
return left(fullfile,c)